package Chapter06.Homework;

import java.util.Arrays;
import java.util.Random;

//福彩双色球的玩法分为红球和篮球
public class Test07 {
    public static void main(String[] args) {
        Random r=new Random();
        String b[]=new String[33];
        for (int i=0;i<b.length;i++){
            if(i<9){
                b[i]="0"+(i+1);
            }else {
                b[i]=""+(i+1);
            }
        }

        //定义存放红球的数组，还有存放篮球的数量
        String red[]=new String[6];
        String blue;

        boolean[] flags=new boolean[33];
        for (int i=0;i<flags.length;i++){
            flags[i]=false;
        }
        int index;
        for (int i=0;i<red.length;i++){
            do{
                index=r.nextInt(33);
            }while (flags[index]);
            red[i]=b[index];
            flags[index]=true;
        }
        Arrays.sort(red);
        blue=b[r.nextInt(16)];
        System.out.println("本期开奖号码：");
        for (int i=0;i<red.length;i++){
            System.out.print("红球"+red[i]+" ");
        }
        System.out.println(" 蓝球"+blue);
    }
}
